<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>我的消息</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
  
<body>
<div class="container-fluid p-t-15">
    <div id="app" style="position: fixed;margin-top:30px;left: 300px">
        <table border="1px" width="800">
            <tr id="auctioningNowul" style="font-size: 24px;">
                <td class="jingpaili">序             号</td>
                <td class="jingpaili">用户姓名</td>
                <td class="jingpaili">操作内容</td>
                <td class="jingpaili">操作对象</td>
                <td class="jingpaili">时间</td>
            </tr>
            
            <tr v-for="(n,key) in news">
            	
            	<td>{{key+1}}</td>
            	<td>{{uname}}</td>
            	<td>{{n.content}}</td>
            	<td>{{n.object}}</td>
            	<td>{{n.time}}</td>
           		
            </tr>
        </table>
        
        <button @click="firstPage()">首页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="prePage(page)">上一页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<label id="currentPage" v-model='page'>1</label> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="nextPage(page)">下一页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="lastPage(totalPages)">末页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						跳到<input v-model="pages" type="text">
					<button @click="jumpPage(pages)">跳转</button>
    </div>
  
  
</div>
<script type="text/javascript">
new Vue  ({
		el:"#app",
		data:{
			news:[],
			page:'',
			pages:'',
		 totalPages :'',
		 
		 
			
		},
				
		mounted(){
			alert("方法进入");
			axios.get("log/findAllnews?page=1").then(res =>{
				this.news = res.data.data;
				this.page = 1;
				this.totalPages =res.data.totalPages; 
				this.uname = res.data.uname;
				console.info(res);
			})
	
		},
		methods:{
			firstPage:function(){
				window.location.reload();
			},
			prePage:function(page){
				
				page = page -1;
				alert(page);
				if(page<1){
					alert("已经是首页了")
					
				}else{
					axios.get('log/findAllnews?page='+page).then(res =>{
						this.news = res.data.data;
						this.page = page;
						document.getElementById("currentPage").innerHTML = this.page; 
						console.info(this.news);
					})
				}
				
			},
			nextPage:function(page){
				
				page = page +1;
				alert(page);
				if(page>this.totalPages){
					alert("已经是最后一页了哦");
				}else{
					axios.get('log/findAllnews?page='+page).then(res =>{
						this.news = res.data.data;
						this.page = page;
						document.getElementById("currentPage").innerHTML = this.page; 
						console.info(res);
					})
				}
	
			},
			lastPage:function(totalPages){
				
				this.page = totalPages;
				axios.get('log/findAllnews?page='+this.page).then(res =>{
					this.news = res.data.data;
					document.getElementById("currentPage").innerHTML = this.page; 
					console.info(this.news);
				})
			},
			jumpPage:function(pages){
				
				this.page = pages;
				axios.get('log/findAllnews?page='+this.page).then(res =>{
					this.news = res.data.data;
					document.getElementById("currentPage").innerHTML = this.page; 
					console.info(this.news);
				})
			}
		}

	})
	
	
	
				
	



</script>



<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
</body>
</html>